package com.ticket.sass.provider.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ticket.sass.common.entity.tenant.TenantFundFlowEntity;
import com.ticket.sass.provider.dto.input.tenant.TransactionInput;
import com.ticket.sass.provider.mapper.TenantFundFlowMapper;
import com.ticket.sass.provider.service.BaseService;
import org.springframework.stereotype.Service;

import java.util.Objects;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author ywb
 * @since 2024-03-19
 */
@Service
public class TenantFundFlowServiceImpl extends ServiceImpl<TenantFundFlowMapper, TenantFundFlowEntity> implements BaseService<TenantFundFlowEntity> {
    
    

    public IPage<TenantFundFlowEntity> iPage(Long tenantId, TransactionInput input) {
        if (Objects.isNull(input)) {
            return null;
        }
        
        // 创建 Page 对象
        Page<TenantFundFlowEntity> page = new Page<>(input.getPageNum(), input.getPageSize());
        
        // 创建 QueryWrapper 对象
        QueryWrapper<TenantFundFlowEntity> queryWrapper = buildQueryWrapper(this.getEntityClass(), input);
        
        queryWrapper.eq("tenant_id", tenantId);
        
        // 在此根据需要添加其他查询条件
        queryWrapper.orderByDesc("id");
        
        // 调用 this.page 方法
        return this.page(page, queryWrapper);
    }
}
